
   function check()
   {
      var reg = /^\s*|\s*$/g;
	    var txt="";
      var username1=document.form.username.value;
      var password1=document.form.password.value;
      var regMobile = /^(13[0-9]|14(5|7)|15(0|1|2|3|5|6|7|8|9)|17[0-9]|18[0-9])\d{8}$/;
      var mflag = regMobile.test(document.form.phone.value);
      var uv = username1.replace(reg, "");
      var ut = password1.replace(reg, "");
      var len = /^(?=.*\d.*)(?=.*[a-zA-Z].*).{1,8}$/;
     if(username1=="")
      {
          txt+="Please enter your user name \n";
      }
     else  if(!/^\w+$/.test(uv))
           {
              txt="User name is not standard \n"
           }
           else if(username1.charAt(0)>='0'&&username1.charAt(0)<='9')
                {
                    txt="User name is not the first number\n";
                }
     if(password1=="")
      {
          txt+="Please enter the password \n";
      }
     else if(!/^\w+$/.test(ut))
          {
              txt+="The password is not standard\n";
          }
  
          else
          { 
              if(!len.test(password1))
              {
                  txt+="Password must be a combination of letters and characters, and the length of no more than eight\n";
              }
          }
 
     if(password1!=document.form.pwd_again.value)
      {
          txt+="Two input password is not consistent  \n";
      }
     if(document.form.phone.value=="")
      {
          txt+="Please enter the phone number\n";
      }
     else if(document.form.phone.value.length!=11)
          {
              txt+="Mobile phone number length is not standard \n";
          }
          else if(!mflag)
                {
                    txt+="The format of the mobile phone number is not correct \n";
                }
    
      if(document.form.email.value=="")
        {
            txt+="Please enter the email address\n";
        }
      else
        {
          with(document.form.email)
          {
              apos=value.indexOf("@");
              dotpos=value.lastIndexOf(".");
              if(apos<1||dotpos-apos<2)
              {
                  txt+="Email address format is not correct \n";
              }
          }
        }
     if(txt=="")
      {
          return true;
      }
     else
      {
          alert(txt);
          location="zhuce.php";
          return false;
      }
}

